-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for Symfony Mailer #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adding `const`s for #1
Yeah, I have to admit that I didn't take care about SwiftMailer ;-) So this is certainly a good idea! The problem I'm seeing is this: If we now introduce So I have another idea: Put it into the config file modules:
enabled:
- Symfony:
mailer: 'swiftmailer' # or 'symfony_mailer' Advantages:
What do you think? |
Even better 👍 |
Ok, i think i got it. 😃 modules:
enabled:
- Symfony:
mailer: 'symfony_mailer' and //...
$I->seeEmailIsSent(2); results in:
|
I'm merging this, but I didn't double-check it :-) |
@TavoNiievez looks like there are some problems - could you take a look? https://github.com/Codeception/module-symfony/actions/runs/205934965 |
@ThomasLandauer I saw them a couple of weeks ago when you merged, but it seems to be a dependency related issue installing the project (friendsofphp/php-cs-fixer 3 with symfony/console 5 to be exact) and not really with the code I edited. Resolving those conflicts should be a separate PR. |
OK, I wasn't sure if you'd get the notification too. BTW: I think the main problem is that the Symfony module currently doesn't have a maintainer. Would you be interested? |
For me it would be a pleasure to help. I just joined as a Specify and Verify maintainer and I would like to implement some changes in Module Asserts and Lib Asserts, but after that I was planning to send PR's to the Symfony Module and the Doctrine Module. It's just that I think it's essential to do the work first in those libraries that are smaller and then make changes in a slightly more complex one like the Symfony module. so my answer is: 'Eventually yes' 😃 |
@DavertMik, @Naktibalda are you still looking for a maintainer of the Symfony module? Codeception/Codeception#4243 (comment) May I suggest TavoNiievez? |
* Update Symfony.php Fixing `seeEmailIsSent()` for [Symfony Mailer](https://symfony.com/doc/master/mailer.html) How did I figure it out (=Symfony internals): [`mailer_debug.php`](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/FrameworkBundle/Resources/config/mailer_debug.php) sends the [`MessageDataCollector`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Mailer/DataCollector/MessageDataCollector.php) to [`mailer.html.twig`](https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/mailer.html.twig#L9), which shows that the number of `events.messages` is the thing to look for. I'm just adding this number to the number returned by the SwiftMailer Collector. Limitations (=TODO): * I have both SwiftMailer and Symfony Mailer installed - don't know what happens if you only have one (or none) * I didn't add any tests - don't know how to do that * Update Symfony.php * Added a more descriptive fail comment * Update Symfony.php Adding `const`s for ThomasLandauer#1 * mailer setting in module config * Fix little Typo Co-authored-by: Gustavo Nieves <37160403+TavoNiievez@users.noreply.github.com>
Hi @ThomasLandauer , I've been looking at your PR Codeception#9 , and I've some changes that I want to suggest to you.
First, I used an optional parameter in the
seeEmailIsSent
function because it is a way to add this new functionality without creating BC, by default it is 'swiftmailer' as before, but if the user so wishes, he can pass 'symfony_mailer' as the second parameter to this function to use that 'Profile Collector'.Secondly, I validated that at least one of the 'Profile Collector' exists:
Then, I added this logic, in this case it's enough to write 'else' and not 'elseif' since above we verified that there is a valid 'Profile Collector'.
And finally I took the opportunity to add support for Symfony Mailer in the
debugResponse
function, in this way the complete module is now compatible with Symfony Mailer without breaking the code of the users who use it with Swift Mailer. (So the name of the PR should change).I'll stay tuned to your comments. Cheers!